package com.jk.vehicle.core.filter;

import com.alibaba.fastjson.serializer.ValueFilter;
import com.jk.vehicle.core.utils.JsoupUtil;
import org.apache.commons.lang3.StringUtils;

/**
 * 自定义JSON序列化值转换器
 *
 * @author KangJian
 * @date 2018/08/17
 */
public class ThirdJsonValueFilter implements ValueFilter {

    @Override
    public Object process(Object object, String name, Object value) {
        // 过滤特殊字符
        if (value instanceof String) {
			if (StringUtils.isBlank(value.toString())) {
        		return null;
			}
			String result = JsoupUtil.clean(value.toString());
        	if (StringUtils.isBlank(result)) {
        		return null;
			} else {
				return result;
			}
        }
        return value;
    }
}
